\documentstyle[]{article}

\begin{document}
\title{DSIM: DVN SImulation Manifest\\
\small{Revision 3}
\author{Tyson Malchow}
}
\maketitle

\section{Document Format}

\subsection{Structure}
This document describes the network packet layout of all DVN communications. It
is structured in a hierarchical such that each section level represents the
layer of the data, and each section number represents some packet type for a
given layer.\\
For example, a data description at {\bf 1.2} would represent the second
valid data-type contained within the higher layer {\bf 1}. A packet existing
at {\bf 3.2.3} would therefore have 3 distinct layers (each with its associated
properties and declarations) thereby describing an entire DVN packet.
\subsection{Format}
The format used by each layer is as follows:
\begin{description}
\item[Context Definitions] These are declarations that declare some specific
set of requirements for the layers above the current. They are listed as {\it
DATA-LAYER-DECLARATION[COMPONENT-NUMBER]=VALUE}. This means that the {\it
COMPONENT-NUMBER} component of data of type {\it DATA-LAYER-DECLARATION} has a
value of {\it VALUE}.
\item[NBDF description] This is the description of the raw packet format, as
defined by NBDF. It follows the form {\it nbdf(FORMAT)}, where {\it FORMAT} is
the physical layout of the packet data.\\
NBDF provides a number of different primitives, each described by the following
declarations:
\begin{itemize}
  \item i: 32 bit integer
  \item t: ptime\_t
  \item n: precoded NBDF chunk
  \item b: binary chunk
  \item s: null-delimited string
  \item c: single character
  \item a: in\_addr\_t internet address
  \item d: double
  \item m: multi-nbdf chunk
\end{itemize}
Following the description, each of the components listed in the NBDF
definition are described by their index, beginning at 1.
\end{description}

\section{Network Specificaitons}
\begin{description}
        \item[1.] Simulation Frame: Any frame for communication between two DVN instances.
               \\ {\it nbdf({\bf iin})}
                \begin{description}
                        \item[1]: Constant prefix for validation. Should be "NETSIM\_PREFIX".
                        \item[2]: Command identifier. Should be of the famility "NETSIM\_CMD\_*".
                        \item[3]: Command-specific data.
                \end{description}
        \item[1.1.] Master Frame: Any frame destined for a master - this is
        typically synchronization frames and data tracking frames. 
        	\\ {\it 1[2]=NETSIM\_CMD\_MASTERDELIV, nbdf({\bf in})}
                \begin{description}
                        \item[1]: Command identifier. Should be of the family "SIM\_MFRAME\_CMD\_*".
                        \item[2]: Command-specific data.
                \end{description}
		\item[1.1.1.] Processing timeslot complete: Any frame destinted for a worker -
		this is any simulation-related data. \\ {\it
		1.1[1]=SIM\_MFRAME\_CMD\_DONETIME, nbdf({\bf t})}
                \begin{description}
                        \item[1]: Time the next event occurs on this worker.
                \end{description}
		\item[1.1.2.] A tracking response for a particular node IP \\ {\it
		1.1[1]=SIM\_MFRAME\_CMD\_TRACKRESP, nbdf({\bf ia})}
		 		\begin{description}
                        \item[1]: Tracking ID
                        \item[2]: IP address of corresponding node
                \end{description}
        \item[1.2.] Worker Frame: Any frame destinted for a worker - this is any simulation-related data.
        	\\ {\it 1[2]=NETSIM\_CMD\_WORKERDELIV, nbdf({\bf in})}
                \begin{description}
                        \item[1]: Command identifier. Should be of the family
                        "SIMFRAME\_WFRAME\_CMD\_*".
                        \item[2]: Command-specific data.
                \end{description}
		\item[1.2.1.] Simulation Operation: some simulation-related
		event to be executed on the worker.\\  {\it 1.2[1]=SIM\_WFRAME\_CMD\_OP,
		nbdf({\bf in})}
				\begin{description}
                        \item[1]: Operation Code. Should be of the family
                        "SIMOP\_CODE\_*".
                        \item[2]: Operation specific data.
                \end{description}
		\item[1.2.1.1.] Create Nodes Simop: A command to create some number of
		nodes on a worker instance.\\ {\it 1.2.1[1]=SIMOP\_CODE\_CNODES, nbdf({\bf
		iaiiiiccc})}
				\begin{description}
                        \item[1]: Number of nodes to create
                        \item[2]: Bootstrap address
                        \item[3]: ID of network to create the nodes
                        \item[4]: ID of module to instantiate
                        \item[5]: Logging level for these nodes
                        \item[6]: Tracking identifier
                        \item[7]: Nonzero if bootstrap address is valid
                        \item[8]: Nonzero if node should have logging enabled
                        \item[9]: Nonzero if tracking ID is valid/enabled
                \end{description}
		\item[1.2.1.2.] End Simulation Simop: Notifies a worker that the simulation
		has ended.\\ {\it 1.2.1[1]=SIMOP\_CODE\_END, nbdf()}
		\item[1.2.1.3.] Load Module Simop: Notifies a worker to load a module from
		disk.\\ {\it 1.2.1[1]=SIMOP\_CODE\_MODLOAD, nbdf({\bf is})}
				\begin{description}
                        \item[1]: ID of module
                        \item[2]: Filename of module
                \end{description}
		\item[1.2.1.4.] Network Operation Simop: Notifies a worker to perform some
		network topology operation - creation, connection, and disconnection.\\ {\it
		1.2.1[1]=SIMOP\_CODE\_NETWORK, nbdf({\bf iiidddccc})}
				\begin{description}
                        \item[1]: Network ID1
                        \item[2]: Network ID2
                        \item[3]: Default network delay
                        \item[4]: Network reliabliliy
                        \item[5]: Network variability
                        \item[6]: Network variability range (UNUSED?)
                        \item[7]: Nonzero if this is a connect command
                        \item[8]: Nonzero if this is a create command
                        \item[9]: Nonzero if this is a disconnect command
                \end{description}
		\item[1.2.2.] VCI Delivery: Some packet data and header
		transport information for delivery of simulated network.\\ {\it
		1.2[1]=SIM\_WFRAME\_CMD\_VCIDELIV, nbdf({\bf m})}
				\begin{description}
                        \item[1]: Array of individual delivery frames
                \end{description}
		\item[1.2.2.1.] VCI Network Frame: A single frame bound for delivery to a
		particular endpoint within the network simulation. {\it nbdf({\bf aiaiitb})}
				\begin{description}
                        \item[1]: Source IP
                        \item[2]: Source port
                        \item[3]: Destination IP
                        \item[4]: Destination port
                        \item[5]: Network source ID
                        \item[6]: Delivery time
                        \item[7]: Packet payload
                \end{description}
		\item[1.2.3.] Process Time Command: \\  {\it
		1.2[1]=SIM\_WFRAME\_CMD\_PROCTIME, nbdf({\bf t})}
				\begin{description}
                        \item[1]: Time issued for worker to process
				\end{description}
        \item[2.] Controller Frame

mframes: in command, data
SIM\_MFRAME\_CMD\_TRACKRESP ia trackingid, address

\end{description}
\end{document}
